programming4us
           
 
 
Windows

Windows 7: Managing Your Hardware with Device Manager (part 4) - Writing a Complete List of Device Drivers to a Text File

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
12/29/2010 8:05:15 PM

Writing a Complete List of Device Drivers to a Text File

There are times when you wish you had a list of all the drivers installed on your PC. For example, if your system crashes, it would be nice to have some kind of record of what drivers are in there. More likely, such a list would come in handy if you have to set up your PC from scratch and you want to know which drivers you have to update.

How do you get such a list? Oddly, Windows doesn’t give you any straightforward way to do this. However, you can make your own list by using a script like the one shown in Listing 1.



Listing 1. Script That Writes a Complete List of a PC’s Installed Device Drivers to a Text File
Dim strComputer, objWMI, collDrivers, objDriver, intDrivers
Dim objFSO, strFolder, objFile
'
' Change the following value to the path of the folder
' where you want to store the text file
'
strFolder = "d:\backups\"
'
' Initialize the file system object
'
Set objFSO = CreateObject("Scripting.FileSystemObject")
'
' Create the text file
'
Set objFile = objFSO.CreateTextFile(strFolder & "drivers.txt", True)
'
' Get the WMI object
'
strComputer = "."
Set objWMI = GetObject("winmgmts:\\" & strComputer)
'
' Return the collection of device drivers on the computer
'
Set collDrivers = objWMI.ExecQuery _
("Select * from Win32_PnPSignedDriver")
'
' Run through each item in the collection
'
intDrivers = 0
For Each objDriver in collDrivers
'
' Write the driver data to the text file
'
objFile.WriteLine(objDriver.DeviceName)
objFile.WriteLine("========================================")
objFile.WriteLine("Device Class: " & objDriver.DeviceClass)
objFile.WriteLine("Device Description: " & objDriver.Description)
objFile.WriteLine("Device ID: " & objDriver.DeviceID)
objFile.WriteLine("INF Filename: " & objDriver.InfName)
objFile.WriteLine("Driver Provider: " & objDriver.DriverProviderName)
objFile.WriteLine("Driver Version: " & objDriver.DriverVersion)
objFile.WriteLine("Driver Date: " & ReturnDriverDate(objDriver.DriverDate))
objFile.WriteLine("")
intDrivers = intDrivers + 1
Next
'
' Close the text file
'
objFile.Close
WScript.Echo "Wrote " & intDrivers & " drivers to the text file."

'
' ReturnDriverDate()
' This function takes the driver datetime value and converts
' it to a friendlier date and time format
'

Function ReturnDriverDate(dDriverDate)
Dim eventDay, eventMonth, eventYear
Dim eventSecond, eventMinute, eventHour
eventYear = Left(dDriverDate, 4)
eventMonth = Mid(dDriverDate, 5, 2)
eventDay = Mid(dDriverDate, 7, 2)
eventHour = Mid(dDriverDate, 9, 2)
eventMinute = Mid(dDriverDate, 11, 2)
eventSecond = Mid(dDriverDate, 13, 2)
ReturnDriverDate = DateSerial(eventYear, eventMonth, eventDay) & _
" " & TimeSerial(eventHour, eventMinute, eventSecond)
End Function


The script uses VBScript’s FileSystemObject to connect to the PC’s file system. In this case, the script uses FileSystemObject to create a new text file in the folder specified by strFolder. The script then sets up the usual Windows Management Instrumentation (WMI) object, and then uses WMI to return the collection of installed device drivers. A For Each...Next loop goes through each device and writes various data to the text file, including the device name and description, and the driver version and date.

Uninstalling a Device

When you remove a Plug and Play device, the BIOS informs Windows 7 that the device is no longer present. Windows 7, in turn, updates its device list in the Registry, and the peripheral no longer appears in the Device Manager display.

If you’re removing a legacy device, however, you need to tell Device Manager that the device no longer exists. To do that, follow these steps:

1.
Click the device in the Device Manager tree.

2.
Select Action, Uninstall. (Alternatively, click Uninstall in the toolbar or open the device’s properties sheet, display the Driver tab, and click Uninstall.)

3.
When Windows 7 warns you that you’re about to remove the device, click OK.
Other -----------------
- SOA with .NET and Windows Azure: WCF Extensions - WCF Transactions (part 2)
- SOA with .NET and Windows Azure: WCF Extensions - WCF Transactions (part 1)
- Windows 7: Recovering from a Problem
- Windows 7: Troubleshooting Tools (part 3) - Checking for Solutions to Problems
- Windows 7: Troubleshooting Tools (part 2) - Running the Memory Diagnostics Tool
- Windows 7: Troubleshooting Tools (part 1) - Running the Windows 7 Troubleshooters
- Windows Vista : User Account Control
- Windows 7 : Troubleshooting Strategies - Determining the Source of a Problem (part 3)
- Windows 7 : Troubleshooting Strategies - Determining the Source of a Problem (part 2)
- Windows 7 : Troubleshooting Strategies - Determining the Source of a Problem (part 1)
- Windows 7 : Enabling MAC Address Filtering
- Windows 7 : Changing the Default SSID
- Windows 7 : Disabling Network SSID Broadcasting
- Windows 7 : Encrypting Wireless Signals with WPA
- Windows 7 : Positioning the Access Point for Maximum Security
- SOA with .NET and Windows Azure : WCF Extensions - WCF Security
- Windows 7 : Specifying a New Administrative Password
- Windows 7 : Displaying the Router’s Setup Pages
- Windows 7 : Preventing Users from Logging On at Certain Times
- Windows 7 : Removing Stored Remote Desktop Credentials
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us